package com.zznj.xzjc.adapter;

import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zznj.xzjc.R;
import com.zznj.xzjc.net.entity.DiaoChaQuZhengBean;
import com.zznj.xzjc.utils.TimeUtils;

import java.util.List;

import androidx.annotation.Nullable;

/**
 * 描述：添加类的描述
 *
 * @author wx5e48d604c2885118
 * @time 2020/4/7
 */
public class DiaoChaQuZhengAdapter extends BaseQuickAdapter<DiaoChaQuZhengBean, BaseViewHolder> {
    private OnImageClickListener mOnImageClickListener;
    public void setOnImageClickListener( OnImageClickListener listener) {
        mOnImageClickListener = listener;
    }
    public interface OnImageClickListener {

        void onItemClick(View view, int c_pos,int f_pos);
    }

    public DiaoChaQuZhengAdapter(int layoutResId, @Nullable List<DiaoChaQuZhengBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, DiaoChaQuZhengBean item) {
        helper.setText(R.id.tv_title,item.getClueName());
        helper.setText(R.id.tv_date,"立案时间："+ TimeUtils.getTime(item.getOurClueTime(),"yyyy-MM-dd"));
        helper.setText(R.id.tv_address,"领域："+item.getClueDomainName());
        TextView tv = helper.getView(R.id.zsTv);
        if("EXISTS".equals(item.getSaveState())){
            tv.setText("已上传");
            tv.setBackgroundResource(R.drawable.btn_ysc_shape);
            tv.setTextColor(mContext.getResources().getColor(R.color.color_ysc));
        }else{
            tv.setText("未上传");
            tv.setBackgroundResource(R.drawable.btn_wsc_shape);
            tv.setTextColor(mContext.getResources().getColor(R.color.color_wsc));
        }
    }
}
